package com.project.internship.controller.info;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.internship.entity.resp.RespPageBean;
import com.project.internship.service.AllotService;
import com.project.internship.vo.StudentDeptMajorClassVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 教师端学生信息
 */
@RestController
@RequestMapping("/information/allot")
public class InfoTeacherStudentController {

    @Autowired
    AllotService allotService;

    /**
     * 查询学院分配的学生信息
     * 根据学号进行单个查询
     * @param current
     * @param size
     * @param keyword
     * @return
     */
    @GetMapping("/")
    public RespPageBean getAllAllotStudents(@RequestParam(defaultValue = "1") Integer current,
                                             @RequestParam(defaultValue = "10") Integer size,
                                             String keyword){
        Page<StudentDeptMajorClassVO> page = new Page<>(current,size);

        Long total = allotService.getAllAllotStudents(page,keyword).getTotal();
        List<StudentDeptMajorClassVO> data =  allotService.getAllAllotStudents(page,keyword).getRecords();

        return new RespPageBean(total,data);
    }



}
